﻿using System;
using ProtoBuf;

namespace LingDong.IndexEntities.Dictionary
{
    [ProtoContract]
    [Serializable]
    public class HitListEntity
    {
        #region Constructor

        private HitListEntity()
        {
        }

        public HitListEntity(short senIndex, short termIndex, PanGu.POS pos, TermHTMLPosition position, int font)
        {
            this.SentenceIndex = senIndex;
            this.TermIndex = termIndex;
            this.TermPos = pos;
            this.HTMLPosition = position;
            this.FontSize = font;
        }

        #endregion
        

        #region ToString


        public override string ToString()
        {
            return String.Format("Sen: {0}, Term: {1}, POS: {2}, HTMLPos: {3}, Font: {4}",
                SentenceIndex, TermIndex, TermPos, HTMLPosition, FontSize);
        }

        #endregion
        

        #region Feilds
        
        /// <summary>
        /// Term occurs sentence's index in the doc
        /// </summary>
        [ProtoMember(1)]
        public short SentenceIndex { get; set; }

        /// <summary>
        /// Term occurs index in the sentence, position after segment
        /// </summary>
        [ProtoMember(2)]
        public short TermIndex { get; set; }

        /// <summary>
        /// Part of speech
        /// </summary>
        public PanGu.POS TermPos { get; set; }
        [ProtoMember(3)]
        private int TermPosInt
        {
            get { return (int)TermPos; }
            set { TermPos = (PanGu.POS)value; }
        }
        
        /// <summary>
        /// Position of the term in HTML
        /// </summary>
        [ProtoMember(4)]
        public TermHTMLPosition HTMLPosition { get; set; }

        /// <summary>
        /// Font size in html, <![CDATA[<hn></hn]]>
        /// </summary>
        [ProtoMember(5)]
        public int FontSize { get; set; }

        #endregion
    }
}
